package Netty之NIO背景.c4;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.nio.channels.SocketChannel;
import java.nio.charset.Charset;

/**
 * @author ChenweiLin
 * @create 2021-11-09 22:13
 */
public class Client {
    public static void main(String[] args) throws IOException {
        SocketChannel sc = SocketChannel.open();
        sc.connect(new InetSocketAddress("localhost",8080));
        SocketAddress address = sc.getLocalAddress();
        sc.write(Charset.defaultCharset().encode("01231345648943541968465\n"));
        System.in.read();//等待控制台的输入 因为该方法是阻塞方法,实际上是模拟此处有断点的debug模式
    }
}
